package com.adcc.msgsimulator.service.impl;

import com.adcc.msgsimulator.entity.Msg620DO;
import com.adcc.msgsimulator.entity.SvcDO;
import com.adcc.msgsimulator.mapper.SvcMapper;
import com.adcc.msgsimulator.service.SvcService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class SvcServiceImpl extends ServiceImpl<SvcMapper, SvcDO> implements SvcService {


    @Override
    public boolean save(SvcDO svcDO) {
        LambdaQueryWrapper<SvcDO> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.select(SvcDO::getMsgID).eq(SvcDO::getMsgID,svcDO.getMsgID());
        List<SvcDO> list = this.list(queryWrapper);
        //不存在插入
        if(list.size()==0){
            baseMapper.insert(svcDO);
            return  true;
        }
        return false;
    }
}
